package com.baidu.model;

import java.util.List;

import com.jfinal.plugin.activerecord.Model;

/**
 * 用户
 * @author libs
 * 2015-10-27
 */
public class SysUser extends Model<SysUser>{
	
	private static final long serialVersionUID = 282908528936842633L;
	public static final SysUser dao = new SysUser();
	
	public SysUser findByName(String userName) {
		return findFirst("select * from sys_user where userName=?", userName);
	}
	
	/**
	 * 查询未绑定百度账号的用户
	 * @return
	 */
	public List<SysUser> queryUnBindUser() {
		StringBuffer sql = new StringBuffer();
		sql.append("select a.* from sys_user a");
		sql.append(" where a.isDeleted=false and not exists(select b.guid from bd_user b where a.guid=b.userGuid and b.isDeleted=false)");
		return find(sql.toString());
	}
	
}
